home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0399 / 357 < prev    next >
Text File  |  1994-08-27  |  7KB  |  235 lines

  1. Subject: misc kernel patches... (mostly tty stuff)
  2. Date: Sun, 11 Jul 93 21:38:16 CES
  3. From: Juergen Lock <nox@jelal.north.de>
  4. Message-Id: <9307111938.AA00300@jelal.north.de>
  5.  
  6. hi!
  7.  
  8.  now that i'm on the list :) here are a few MiNT 1.07 patches for you
  9. to try out, and for eric to look at when he's back from holiday...
  10.  
  11. 1. blocking writes to a serial port can stop everything, and because of
  12. that may also cause deadlocks like when you do IO with more than one
  13. process (one reading, one writing...)  according to Changes this was
  14. done for Speedo GDOS, so keep it that way for the printer port. :-(
  15. (i already had a similar patch that tried to check for being called from
  16. supervisor mode, that didn't seem to work. Eric?)
  17.  
  18.  it also turns off that hardcoded 10 second timeout on ttys, i think it
  19. only causes trouble...  (think of a user hitting ^S on a terminal, or a
  20. V32 modem doing a retrain...)
  21.  
  22. diff -uw ../bios.c ./bios.c
  23. --- ./bios.c    Sat Jun 26 00:55:22 1993
  24. +++ ./bios.c    Thu Jun 24 21:34:54 1993
  25. @@ -253,8 +253,20 @@
  26.          statdev = dev;
  27.      }
  28.  
  29. +#if 1 /* blocking write()s to a tty shouldn't time out and also should
  30. +     not halt the whole system while they're waiting IMHO.    -nox
  31. +    */
  32. +    if (dev != PRNDEV && !BCOSTAT(statdev)) {
  33. +        do {
  34. +            yield();
  35. +        } while (!BCOSTAT(statdev));
  36. +
  37. +/* provide a 10 second time out only for the printer device */
  38. +    } else if (!BCOSTAT(statdev)) {
  39. +#else
  40.  /* provide a 10 second time out */
  41.      if (!BCOSTAT(statdev)) {
  42. +#endif
  43.          endtime = curtime + 10*200L;
  44.          do {
  45.  #if 0
  46.  
  47. 2. improved fasttext ESC Y patch, only strip bit 7 on args when the
  48. screen is smaller :)
  49.  
  50. diff -uw ../fasttext.c ./fasttext.c
  51. --- ./fasttext.c    Thu Jun 24 20:36:16 1993
  52. +++ ./fasttext.c    Sat Jun 26 02:09:56 1993
  53. @@ -1058,7 +1058,15 @@
  54.      SCREEN *v;
  55.      int c;
  56.  {
  57. +#if 0
  58.      gotoxy(v, c - ' ', escy1 - ' ');
  59. +#else
  60. +    /* some (un*x) termcaps seem to always set the hi bit on
  61. +       cm args (cm=\EY%+ %+ :) -> drop that unless the screen
  62. +       is bigger.    -nox
  63. +    */
  64. +    gotoxy(v, (c - ' ') & (v->maxx|0x7f), (escy1 - ' ') & (v->maxy|0x7f));
  65. +#endif
  66.      state = normal_putch;
  67.  }
  68.  
  69. 3. intresting one: reportedly some(?) 68000 CPUs have a bug that
  70. causes interrupts sometimes to get lost when a rte instruction follows a
  71. movem...  i don't have a logic analyzer here :-) but i seem to get less
  72. unexplained protocol errors in uucps log file since i patched that here
  73. and in my serial driver.  (of course there are still a few of this left
  74. in TOS itself too...)
  75.  
  76. diff -uw ../intr.spp ./intr.spp
  77. --- ./intr.spp    Sat Jun 26 01:08:18 1993
  78. +++ ./intr.spp    Sat Jun 26 01:20:54 1993
  79. @@ -272,6 +272,10 @@
  80.      move.l    _sig_routine,a1        ; get handler
  81.      jsr    (a1)            ; go do it
  82.      movem.l    (sp)+,d0-d2/a0-a2
  83. +; 68000 processor bug: rte right after movem can eat interrupts...
  84. +%ifndef ONLY030
  85. +    nop
  86. +%endif
  87.      rte
  88.  
  89.  ;
  90.  
  91. and...  4. finally get select, ioctl FIONREAD etc work with XKEY!  side
  92. effect of this is that Cconin etc now have to return a second character
  93. of an escape sequence etc too, i.e. whether you get a key code or the
  94. full expanded sequence now only depends on how the _first_ character was
  95. read. (anyway i would say this is more a feature than a bug...)
  96.  
  97. diff -ru ../console.c ./console.c
  98. --- ../console.c    Tue May  4 17:42:38 1993
  99. +++ ./console.c    Sun Jul 11 02:08:50 1993
  100. @@ -7,6 +7,8 @@
  101.  
  102.  #include "mint.h"
  103.  
  104. +extern char vt52xkey[];
  105. +
  106.  /*
  107.   * These routines are what Cconout, Cauxout, etc. ultimately call.
  108.   * They take an integer argument which is the user's file handle,
  109. @@ -28,6 +30,13 @@
  110.      r = 1;        /* default is to assume input waiting (e.g. TOS files)*/
  111.      (void)(*f->dev->ioctl)(f, FIONREAD, &r);
  112.  
  113. +    if (!r && is_terminal(f)) {
  114. +        struct tty *tty = (struct tty *)f->devinfo;
  115. +        int scan = tty->state & TS_ESC;
  116. +
  117. +        if (scan && (tty->xkey ? tty->xkey[scan] : vt52xkey[scan]))
  118. +            r = 1;
  119. +    }
  120.      return r;
  121.  }
  122.  
  123. diff -ru ../dosfile.c ./dosfile.c
  124. --- ../dosfile.c    Thu Jun 24 20:36:08 1993
  125. +++ ./dosfile.c    Sun Jul 11 03:01:02 1993
  126. @@ -9,6 +9,7 @@
  127.  #include "mint.h"
  128.  
  129.  extern char temp1[];    /* see filesys.c */
  130. +extern char vt52xkey[];
  131.  
  132.  static long do_dup P_((int,int));
  133.  static void unselectme P_((PROC *));
  134. @@ -925,6 +926,14 @@
  135.          r = (*f->dev->ioctl)(f, cmd, (void *)arg);
  136.          if (r == EINVFN && is_terminal(f)) {
  137.              r = tty_ioctl(f, cmd, (void *)arg);
  138. +        } else if (cmd == FIONREAD && !r && !(*(long *)arg) &&
  139. +                is_terminal(f)) {
  140. +            struct tty *tty = (struct tty *)f->devinfo;
  141. +            int scan = tty->state & TS_ESC;
  142. +
  143. +            if (scan && (tty->xkey ? tty->xkey[scan] :
  144. +                    vt52xkey[scan]))
  145. +                *(long *)arg = 1;
  146.          }
  147.          return r;
  148.      }
  149. @@ -1007,8 +1016,15 @@
  150.  
  151.      for (i = 0; i < MAX_OPEN; i++) {
  152.          if (rfd & mask) {
  153. +            struct tty *tty;
  154. +            int scan;
  155. +
  156.              f = p->handle[i];
  157. -            if ((*f->dev->select)(f, (long)p, O_RDONLY)) {
  158. +            if ((*f->dev->select)(f, (long)p, O_RDONLY) ||
  159. +                (is_terminal(f) &&
  160. +                (scan = (tty=(struct tty *)f->devinfo)->state & TS_ESC) &&
  161. +                (tty->xkey ? tty->xkey[scan] :
  162. +                    vt52xkey[scan]))) {
  163.                  count++;
  164.                  *rfdp |= mask;
  165.              }
  166. diff -ru ../tty.c ./tty.c
  167. --- ../tty.c    Thu Jun 24 20:37:28 1993
  168. +++ ./tty.c    Sun Jul 11 01:49:02 1993
  169. @@ -233,7 +233,7 @@
  170.  
  171.  /* for RAW mode, if there are no more characters then break */
  172.          if ( (mode & (T_RAW|T_CBREAK)) &&
  173. -            !((rdmode & ESCSEQ) && (tty->state & TS_ESC))) {
  174. +            !(tty->state & TS_ESC)) {
  175.              r = 1;
  176.              (void)(*f->dev->ioctl)(f, FIONREAD, &r);
  177.              if (r <= 0) break;
  178. @@ -375,7 +375,7 @@
  179.   *        28-31 are shift+cursor up, down, right, and left
  180.   */
  181.  
  182. -static char vt52xkey[256] = {
  183. +char vt52xkey[256] = {
  184.  '\033', 'P', 0, 0, 0, 0, 0, 0,
  185.  '\033', 'Q', 0, 0, 0, 0, 0, 0,
  186.  '\033', 'R', 0, 0, 0, 0, 0, 0,
  187. @@ -665,19 +665,15 @@
  188.  /* we may be in the middle of an escape sequence */
  189.      scan = (tty->state & TS_ESC);
  190.      if (scan != 0) {
  191. -        if (mode & ESCSEQ) {
  192. -            tab = tty->xkey ? tty->xkey : vt52xkey;
  193. -            r = (unsigned char) tab[scan++];
  194. -            if (r) {
  195. -                c = UNDEF;
  196. -                if (tab[scan] == 0) scan = 0;
  197. -            }
  198. -            else
  199. -                scan = 0;
  200. -            tty->state = (tty->state & ~TS_ESC) | scan;
  201. +        tab = tty->xkey ? tty->xkey : vt52xkey;
  202. +        r = (unsigned char) tab[scan++];
  203. +        if (r) {
  204. +            c = UNDEF;
  205. +            if (tab[scan] == 0) scan = 0;
  206.          }
  207.          else
  208. -            tty->state &= ~TS_ESC;
  209. +            scan = 0;
  210. +        tty->state = (tty->state & ~TS_ESC) | scan;
  211.      }
  212.  
  213.      while (c != UNDEF) {
  214.  
  215.  btw how are you guys do kernel debugging?  has someone hacked gdb for
  216. that already?  i just found a version of templmon with symbol table
  217. support, thats at least better than nothing... (filename was templ202.zip,
  218. don't know if its on atari.archive already)
  219.  
  220.  and i still think that MiNT needs better ways to do fast RAW serial IO,
  221. access modem control lines and speeds >19200, change Iorec buffer sizes,
  222. etc.. but i'll repeat that only if you want it. :-)
  223.  
  224.  cheers
  225.     Juergen
  226. -- 
  227. J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
  228.                                 ...ohne Gewehr
  229. PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA 
  230.  
  231. When you block on a socket call in a Windows application, no activity can
  232. proceed in any windows application, nor will you be able to change the
  233. active Window.  No scheduling cann occur between Windows applications
  234.                             Microsoft TCP/IP Sockets Developer's Kit
  235.